algalcommand.testbench
Class TestNetworkScanner

java.lang.Object
  extended by algalcommand.testbench.TestNetworkScanner

public class TestNetworkScanner
extends java.lang.Object


Nested Class Summary
 class TestNetworkScanner.LantronixDevice
          parsing based on the following c code from Lantronix tech support forums:
           len = recvfrom(sock, buf, sizeof(buf), 0, (struct sockaddr *)&from, &fromLen);            if (len > 4) {                                if (buf[3] != 0xf7) {                    printf("buf[3]=%x\n", buf[3]);                    continue;                }                                printf("Type    : %02x-%02x (%c%c)\n", buf[8], buf[9], buf[8], buf[9] );                printf("Version : Major.Minor: %d.%d\n", buf[7], buf[6] );                printf("Serial #: %02x-%02x-%02x-%02x\n", buf[20], buf[20+1], buf[20+2],                        buf[20+3]);                printf("MAC     : %02x-%02x-%02x-%02x-%02x-%02x\n", buf[24], buf[24+1],                        buf[24+2], buf[24+3], buf[24+4], buf[24+5]);                printf("IP Addr : %s\n", inet_ntoa(from.sin_addr));            } else {                printf("erroneous data.\n");            }            printf("\n");
 
Field Summary
static byte[] LANTRONIX_DISCOVERY_COMMAND
           
static int LANTRONIX_DISCOVERY_PORT
           
static byte LANTRONIX_DISCOVERY_RESPONCE_CODE
           
 java.util.ArrayList<java.lang.String> lastmacs
           
 
Constructor Summary
TestNetworkScanner(java.lang.String subnetaddress)
           
TestNetworkScanner(java.lang.String subnetaddress, int timeout_seconds)
           
 
Method Summary
 TestNetworkScanner.LantronixDevice[] findPBRAddresses()
           
 Photobioreactor[] getPBRs()
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LANTRONIX_DISCOVERY_PORT

public static final int LANTRONIX_DISCOVERY_PORT
See Also:
Constant Field Values

LANTRONIX_DISCOVERY_COMMAND

public static final byte[] LANTRONIX_DISCOVERY_COMMAND

LANTRONIX_DISCOVERY_RESPONCE_CODE

public static final byte LANTRONIX_DISCOVERY_RESPONCE_CODE
See Also:
Constant Field Values

lastmacs

public java.util.ArrayList<java.lang.String> lastmacs
Constructor Detail

TestNetworkScanner

public TestNetworkScanner(java.lang.String subnetaddress)

TestNetworkScanner

public TestNetworkScanner(java.lang.String subnetaddress,
                          int timeout_seconds)
Method Detail

findPBRAddresses

public TestNetworkScanner.LantronixDevice[] findPBRAddresses()
                                                      throws java.net.UnknownHostException,
                                                             java.net.SocketException,
                                                             java.io.IOException
Throws:
java.net.UnknownHostException
java.net.SocketException
java.io.IOException

getPBRs

public Photobioreactor[] getPBRs()
Returns:
All of the Photobioreactors that have been found on the network. This method should not be invoked until after running this object in a thread. Example:
NetworkScanner scanner = new NetworkScanner("192.168.0.*");
Thread t = new Thread(scanner);
t.start(); // causes the NetworkScanner to scan the network for PBRs
t.join();// wait until scanner is done searching the network
pbrarray = scanner.getPBRs();

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments